import React from 'react';
// event 
import emitter from '../../util/events';
// service
import { TanslateTitle } from '../../util/service';
// ant
import { Select, Form } from 'antd';
const FormItem = Form.Item;
const Option = Select.Option;

class TranslateModal extends React.Component {
    constructor(props) {
        super(props);
        this.state = {};
    }

    componentDidMount() {
        emitter.once('submitModal', () => {
            let data = {
                'Language': this.props.form.getFieldValue('translate')
            }
            TanslateTitle(data)
                .then(response => {
                    emitter.emit('tanslateData', response.Data)
                })
        })
    }

    render() {
        const { getFieldDecorator } = this.props.form;
        return (
            <Form>
                <FormItem>
                    {getFieldDecorator('translate')(
                        <Select className="w100" placeholder="请选择">
                            <Option value="cn">中文</Option>
                            <Option value="en">英文</Option>
                        </Select>
                    )}
                </FormItem>
            </Form>
        )
    }
}

export default Form.create()(TranslateModal)